const path = require('path')
const webpack = require("webpack")
const CopyPlugin = require('copy-webpack-plugin')

module.exports = {
    mode: 'development',
    entry: {
        index: path.join(__dirname, 'src', 'index.js'),
        custom_category: path.join(__dirname, 'src', 'custom_category.js'),
        toolbox_label: path.join(__dirname, 'src', 'toolbox_label.js')
    },
    output: {
        path: path.join(__dirname, 'dist'),
        filename: "[name].js"
    },
    plugins: [
        new webpack.optimize.ModuleConcatenationPlugin(),
        new CopyPlugin({
            patterns: [{
                from: path.join(__dirname, 'public'),
                to: path.join(__dirname, 'dist')
            }]
        }),
        new CopyPlugin({
            patterns: [{
                from: path.join(__dirname, 'dep'),
                to: path.join(__dirname, 'dist')
            }]
        }),
        new CopyPlugin({
            patterns: [{
                from: path.join(__dirname, './node_modules/blockly/media'),
                to: path.join(__dirname, 'dist/media')
            }]
        }),
    ],
    devServer: {
        port: 8080,
        static: path.join(__dirname, "dist")
    }
}